package servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.EvenementenIO;
import domein.Evenement;


@WebServlet(name="EventAanpassenServlet", urlPatterns="/EventAanpassen.do")
public class EventAanpassenServlet extends HttpServlet   {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */

	public EventAanpassenServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	protected void doGet(HttpServletRequest req, HttpServletResponse response) 
			throws ServletException, IOException {
		
		EvenementenIO eIo = new EvenementenIO();
		int eventID = Integer.parseInt(req.getParameter("eventID"));
		String naam = req.getParameter("naam");
		String subTitel = req.getParameter("subTitel");
		String datum = req.getParameter("datum");
		int locatieID = Integer.parseInt(req.getParameter("locatie"));
		Evenement ev = eIo.getEvent(eventID);
		int programmaID = ev.getProgrammaID();
		String contactPersoon = req.getParameter("contactpersoon");
		String organisator = req.getParameter("organisator");		
		Evenement e = new Evenement(eventID, naam, subTitel, datum, locatieID, programmaID, contactPersoon, organisator);
		eIo.pasEvenementAan(e);
		response.sendRedirect("eDetails.jsp?eventID="+eventID);
	}
}


